layui.use(['table', 'admin', 'ax','laydate'], function () {
    var $ = layui.$;
    var table = layui.table;
    var $ax = layui.ax;
    var admin = layui.admin;
    var laydate = layui.laydate;

    laydate.render({
      elem: '#startTime'
        	,value:new Date()
    });

    laydate.render({
      elem: '#endTime'
        	,value:new Date()
    });

    /**
     * 装卸签到表管理
     */
    var TransportStevedoreSignin = {
        tableId: "transportStevedoreSigninTable"
    };

    /**
     * 初始化表格的列
     */
    TransportStevedoreSignin.initColumn = function () {
        return [[
            {type: 'checkbox'},
            {field: 'id', hide: true, title: '主键'},
            {field: 'gongsi', sort: true, title: '公司'},
            {field: 'auditBy', sort: true, title: '工号'},
            {field: 'auditTime', sort: true, title: '姓名'},
            {field: 'tel', sort: true, title: '电话'},
            {field: 'signinTimes', sort: true, title: '签到时间'},
            {field: 'v1', sort: true, title: '定位'},
            {field: 'signoutTimes', sort: true, title: '签退时间'},
            {field: 'v2', sort: true, title: '定位'},
        ]];
    };

    /**
     * 点击查询按钮
     */
    TransportStevedoreSignin.search = function () {
        var queryData = {};
        queryData['startTime'] = $("#startTime").val();
        queryData['endTime'] = $("#endTime").val();
        queryData['condition'] = $("#condition").val();
        queryData['operateId'] = $("#operateId").val();
        table.reload(TransportStevedoreSignin.tableId, {
            where: queryData, page: {curr: 1},
             done:function () {
            }
        });
    };

    // 渲染表格
    var tableResult = table.render({
        elem: '#' + TransportStevedoreSignin.tableId,
        url: Feng.ctxPath + '/transportStevedoreSignin/list',
        page: true,
        limit: 40,
		limits:[60,120,240,360,480,600,1500,3000],
        height: "full-60",
        toolbar: '#toolbarfrom',
        cellMinWidth: 100,
        cols: TransportStevedoreSignin.initColumn()
    });

    $('#weChat').click(function () {
        layer.open({
            type: 2,
            title: '装卸工微信签到码',
            area: ['1000px', '550px'],
            anim: 5,
            content: Feng.ctxPath + '/transportStevedoreSignin/toqrCode',
            end: function () {
            }
        });
    });

    // 搜索按钮点击事件
    $('#btnSearch').click(function () {
        TransportStevedoreSignin.search();
    });

});
